package com.example.demo.util;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;

/**
 * @Classname Test
 * @Description TODO
 * @Date 2019/8/9 9:52
 * @Created by yby
 */
public class Test {
    private static Long mark = 0L;
    public static final long valBit = 1L << 32;

    private static void updateMark(byte val, long valBit) {

        if (mark == null) {
            mark = 0L;
        }
        if (val == 1) {
            mark = mark | valBit;
        } else mark = mark & (~valBit);
        System.out.println("mark:"+mark);
    }
    public static String getLastElevenCharacters(String input) {
        if (input == null) {
            return null;
        }
        int length = input.length();
        if (length <= 11) {
            // 如果字符串长度小于等于 11 位，返回原字符串
            return input;
        } else {
            // 从后面往前截取 11 位
            return input.substring(length - 11);
        }
    }
    public static void main(String[] args) throws Exception {

        String str = "86 15196705987";
        String lastElevenCharacters = getLastElevenCharacters(str);
        String result = str.substring(str.length() - 3);
        System.out.println(lastElevenCharacters);

//        updateMark((byte)1,valBit);
//
//
//        System.out.println(1 | 2);
////        System.out.println(1L << 32);
//        System.out.println("取模："+1724902981676297L%16);
////        System.out.println(8/2);
//        List objects = Collections.synchronizedList(new ArrayList<>());
//        List<String> userlist = new ArrayList<String>();
//        userlist.add("yulon");
//        userlist.add("xiaoyun");
//        userlist.add("羽龙共舞");
//        System.out.println("使用普通for循环:");
//        for (int i = 0; i < userlist.size(); i++) {
//            System.out.println(userlist.get(i));
//        }
//        System.out.println("使用迭代器循环:");
//        Iterator iterator = userlist.iterator();
//        while (iterator.hasNext()) {
//            System.out.println(iterator.next());
//        }
//        System.out.println("使用增强for循环：");
//        for (String s : userlist) {
//            System.out.println(s);
//        }


        /**
         String str11 = "aaa";
         String str22 = new String("aaa");
         String str33 = str22.intern();
         System.out.println(str11 == str22);
         System.out.println(str11 == str33);



         Integer f1 = 100, f2 = 100, f3 = 150, f4 = 150;
         System.out.println(f1 == f2);
         System.out.println(f3 == f4);

         String str2323 =null;
         if("".equals(null)){
         System.out.println("str不是null");
         }

         int aaa = 2^17;
         String stt = aaa+"";
         System.out.println("stt="+stt);
         String str1 = "通话";
         String str2 = "重地";
         System.out.println(String.format("str1：%d | str2：%d",  str1.hashCode(),str2.hashCode()));
         System.out.println(str1.equals(str2));

         System.out.println(Math.round(-1.5));
         System.out.println(Math.round(1.5));
         //Lists.newArrayList("1", "2");
         System.out.println("我是0000");
         //Thread.sleep(5000);
         System.out.println("我是5000");


         List list = new ArrayList();
         list.add("1");
         for (int i = 0; i < list.size(); i++) {
         System.out.println(list.get(0));
         }

         double a = 1.456;
         double b = 2.0000;
         double c = a+b ;
         double d =(double)Math.round(c*100)/100;
         System.out.println(d);

         com.alibaba.fastjson.JSONObject json1 =new  com.alibaba.fastjson.JSONObject();
         byte[] bytes=json1.getBytes("bytes");
         if(bytes == null){
         System.out.println("bytes为null");
         }
         System.out.println("bytes="+bytes);


         String str = "SelfLotteryAppPro_V1.0.0_20191217.bin";
         File file =new File("D:\\新森\\升级\\new\\SelfLotteryAppPro_version_time.bin");
         System.out.println(file.getName());
         if(file.getName().contains(".bin")){
         System.out.println("yyyyyyyy");
         }


         int m = 1;
         int n = 1;
         for (int i =1;i<4;i++){
         // m++;
         //++n;
         System.out.println("m="+m+"$$$$"+"i="+i+"$$$$"+"n="+n);
         m++;
         ++n;
         }
         //String str = "133";
         /*SortedMap<String, Object> packageParams = new TreeMap<String, Object>();
         packageParams.put("appid", "ff");
         packageParams.put("mch_id", "fefaf");
         packageParams.put("nonce_str", "222");
         packageParams.put("body", "杭州互联通科技有限公司");
         packageParams.put("out_trade_no", "55");
         packageParams.put("total_fee", "88");
         packageParams.put("notify_url", "fefaf");
         packageParams.put("trade_type", "JSAPI");
         packageParams.put("openid", "9658");
         Set<Map.Entry<String, Object>> entries = packageParams.entrySet();
         Iterator<Map.Entry<String, Object>> iterator = entries.iterator();
         while(iterator.hasNext())
         {
         Map.Entry<String,Object> entry=iterator.next();
         System.out.println("排序之后:"+entry.getKey()+" 值"+entry.getValue());
         }*/
        //返回集合
        /*JSONArray jsonArray = new JSONArray();

        //福彩数据
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("buyType", 1);
        jsonObject.put("buyNumber", 1);
        jsonArray.put(jsonObject);

        //体彩数据
        jsonObject = new JSONObject();
        jsonObject.put("buyType", 2);
        jsonObject.put("buyNumber", 1);
        jsonArray.put(jsonObject);

        JSONObject businessJson = new JSONObject();
        businessJson.put("businessId", "test");
        businessJson.put("businessName", "测试商家");
        businessJson.put("businessAddress", "测试商家地址");
        businessJson.put("businessPhone", "测试商家手机");
        businessJson.put("quanType", "5折卷");
        businessJson.put("quanRule", "满100可用");
        businessJson.put("quanParValue", "5元");
        businessJson.put("endDate", "2019-07-07");
        businessJson.put("businessUrl", "https://www.baidu.com?businessId=test");

        JSONObject json = new JSONObject();
        json.put("cpOdd", "mqttTest1");
        json.put("orderId", "20190728162619940507");
        json.put("result", jsonArray);
        json.put("businessJson", businessJson);

        System.out.println(json.toString());
        */
    }

}
